import request from '@/utils/request';

export async function getConditionList(departmentId, page) {
  return await request.post('/api/1.0/department/order/condition/list', {
    departmentId: departmentId,
    pageCurrent: page
  });
}

export async function getConditionListALL() {
  return await request.post('/api/1.0/department/order/condition/list', {
    pageCurrent: '1',
    pageLimit: '1000'
  });
}

export async function delConditionInfo(condId) {
  return await request.post('/api/1.0/department/order/condition/delete', {
    id: condId
  });
}

export async function createCondition(
  conditionName,
  conditionType,
  conditionParams
) {
  return await request.post('/api/1.0/department/order/condition/append', {
    conditionName: conditionName,
    conditionType: conditionType,
    conditionParams: conditionParams
  });
}

export async function getCondInfo(condId) {
  return await request.post('/api/1.0/department/order/condition/info', {
    id: condId
  });
}

export async function getCondInfo3001() {
  return await request.post('/api/1.0/department/order/condition/dic', {
    page: '1'
  });
}

export async function getUserInfo() {
  return await request.post('/api/1.0/manager/user/info', {});
}

/**
 * 重点条件一级数据接口
 * @returns {Promise<void>}
 */
export let getFirstSelectList = async () => {
  return await request.post('/api/1.0/base/r5010classify/list/big');
};

/**
 * 重点条件二级分类，参数从一级分类中得到
 * @param bigClassifyId
 * @param classifyType
 * @returns {Promise<void>}
 */
export let getSecondSelectList = async (bigClassifyId, classifyType) => {
  return await request.post('/api/1.0/base/r5010classify/list/big/center', {
    bigClassifyId, classifyType
  });
};

export let getThirdSelectList = async (bigClassifyId, classifyType) => {
  return await request.post(
    '/api/1.0/base/r5010classify/list/big/center/small',
    {
      bigClassifyId,classifyType
    }
  );
};
